package cn.zhuwj.autodiscovery.common;

import java.util.HashMap;
import java.util.Map;

/**
 * @author zhuwj.cn
 */
public class Constant {

    /**
     * 常用端口对应的服务
     */
    private static Map<Integer, String> PORT_SERVICE = new HashMap<>();

    static {
        PORT_SERVICE.put(21, "FTP");
        PORT_SERVICE.put(22, "SSH、SCP");
        PORT_SERVICE.put(23, "TELNET");
        PORT_SERVICE.put(25, "SMTP");
        PORT_SERVICE.put(53, "DNS");
        PORT_SERVICE.put(67, "BootP server");
        PORT_SERVICE.put(68, "BootP client");
        PORT_SERVICE.put(69, "TFTP");
        PORT_SERVICE.put(80, "HTTP");
        PORT_SERVICE.put(102, "Message transfer agent");
        PORT_SERVICE.put(110, "POP3");
        PORT_SERVICE.put(135, "Remote Procedure Call, RPC");
        PORT_SERVICE.put(139, "netBIOS");
        PORT_SERVICE.put(161, "SNMP");
        PORT_SERVICE.put(443, "HTTPS");
        PORT_SERVICE.put(445, "共享文件夹及打印机");
        PORT_SERVICE.put(808, "omirr文件镜像服务");
        PORT_SERVICE.put(1080, "SOCKS");
        PORT_SERVICE.put(1158, "Oracle EMCTL");
        PORT_SERVICE.put(1443, "SQL Server");
        PORT_SERVICE.put(1521, "Oracle");
        PORT_SERVICE.put(2100, "Oracle XDB FTP");
        PORT_SERVICE.put(3306, "MySQL默认端口");
        PORT_SERVICE.put(3389, "Terminal Service");
        PORT_SERVICE.put(8080, "Oracle XDB");
        PORT_SERVICE.put(9080, "Webshpere应用程序");
        PORT_SERVICE.put(9090, "Webshpere管理工具");
    }

    public static String getServiceName(Integer port,String defaultValue){
        return PORT_SERVICE.getOrDefault(port, defaultValue);
    }
}
